package ar.com.fiuba.ElectronicCircuitAnalyst.domain.impl;

import java.util.List;

import ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.CircuitElement;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.Connection;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.Lead;

public abstract class CircuitElementImpl implements CircuitElement {

	protected String name;

	protected List<Lead> inputLeads;

	protected List<Lead> outputLeads;

	public String getName() {
		return name;
	}

	public Connection connectToInputLead(int index, Lead from) {
		return new ConnectionImpl(from, this.inputLeads.get(index));
	}

	public Connection connectFromOutputLead(int index, Lead to) {
		return new ConnectionImpl(this.inputLeads.get(index), to);
	}

	public List<Lead> getInputLeads() {
		return this.inputLeads;
	}

	public List<Lead> getOutputLeads() {
		return this.outputLeads;
	}
}
